<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BaseURI
 *
 * @author Admin
 */
class Zend_View_Helper_GetCurrentEarning {

    public function getCurrentEarning($contract_price, $reached, $monthly_target, $monthly_max, $commission_percent, $comissions_percent_max) {
        $earning = 0 ;
        if ($reached <= $monthly_max) {
            $earning = $reached * ($contract_price * $commission_percent) / 100;
        }
        else
        {
            $earning = $monthly_max * ($contract_price * $commission_percent) / 100;
            $earning += ($reached-$monthly_max) * ($contract_price * $comissions_percent_max) / 100;
        }
        return $earning;
    }

    public function setView(Zend_View_Interface $view) {
        $this->view = $view;
    }

}

?>
